<template>
    <div>
        <div @click="btnChildEvent">绑定btnChildEvent</div>
        <div @click="unbind">解绑btnChildEvent</div>
    </div>
</template>

<script>
export default {
    emits: ['btnChildEvent'],
    data() {
        return {
            name: 'btnChild'
        }
    },
    mounted(){
        // this.$emit('demo', this.name)
    },
    methods: {
        demo() {
            console.log('来自btnChild', this.name,555)
            // this.$emit('demo', this.name)
        },
        btnChildEvent(){
            this.$emit('btnChildEvent',this.name)
        },
        unbind(){
            // this.$off('btnChildEvent') // 解绑事件，vue3废弃了$on,$off...
        }
    }
}
</script>

<style>

</style>